# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>

_name=StyLua
pkgname=stylua
pkgver=0.19.1
pkgrel=1
pkgdesc='Code formatter for Lua'
arch=('loong64' 'x86_64')
url=https://github.com/JohnnyMorganz/StyLua
license=('MPL2')
depends=('gcc-libs')
makedepends=('git' 'rust')
source=("git+$url.git#tag=v$pkgver")
b2sums=('SKIP')

prepare() {
  cd $_name
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd $_name
  cargo build --release --frozen --all-features
}

check() {
  cd $_name
  cargo test --frozen --all-features
}

package() {
  cd $_name
  install -Dm0755 -t "$pkgdir"/usr/bin target/release/$pkgname
}
